package com.apanal.qlife.common.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * 异常工具类
 * 
 * 
 * @author shuliangxing
 * 
 * @date 2015-9-21上午10:48:28
 */
public class ExceptionUtil {

	/**
	 * 把异常堆栈信息转换成字符串
	 * 
	 * @param t
	 * @return
	 */
	public static String getStackTrace(Throwable t) {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		t.printStackTrace(pw);
		return sw.toString();
	}
}
